import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from "unplugin-auto-import/vite";
import { resolve } from "path";

export default defineConfig({
  plugins: [
    uni(),
    AutoImport({
      imports: ["vue", "uni-app", "pinia"],
      dts: "./auto-imports.d.ts",
    }),
  ],
  optimizeDeps: {
    entries: ["@dcloudio/uni-ui"],
  },
  resolve: {
    alias: {
      "@": resolve(__dirname, "./src"),
    },
  },
  css: {
    preprocessorOptions: {

    },
  },
  build: {
    /** 配置h5打包js,css,img分别在不同文件夹start */
    assetsDir: "static/img/",
    rollupOptions: {
      output: {
        chunkFileNames: "static/js/[name]-[hash].js",
        entryFileNames: "static/js/[name]-[hash].js",
        assetFileNames: "static/[ext]/[name]-[hash].[ext]",
      },
    },
    /** 配置h5打包js,css,img分别在不同文件夹end */
  },
});
